<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>个人博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="个人博客">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="个人博客">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="GWM">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/atom.xml" title="个人博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  
<link rel="stylesheet" href="/css/style.css">

<meta name="generator" content="Hexo 4.2.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">个人博客</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">主页</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="[layout]-设计模式" class="article article-type-[layout]" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2020/04/09/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" class="article-date">
  <time datetime="2020-04-09T06:32:16.000Z" itemprop="datePublished">2020-04-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2020/04/09/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/">设计模式</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="分类"><a href="#分类" class="headerlink" title="分类"></a>分类</h2><ul>
<li><strong>创建型:</strong>  <font color="red"> <strong>工厂模式 单例模式</strong></font></li>
<li><strong>结构性:</strong>  <font color="red"> <strong>适配器 装饰器 代理 外观</strong></font></li>
</ul>
<h2 id="observer-观察者模式"><a href="#observer-观察者模式" class="headerlink" title="observer [观察者模式]"></a>observer [观察者模式]</h2><p><font color="red" >根据状态的变化主动触发观察者队里,hashMap的回调行为一个简单的观察者模式代码实践</font></p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 状态跟踪器</span></span><br><span class="line"> <span class="class"><span class="keyword">class</span> <span class="title">StateTracker</span> </span>&#123;</span><br><span class="line">   <span class="keyword">constructor</span>()&#123;</span><br><span class="line">     <span class="keyword">this</span>.observers  =[];</span><br><span class="line">     <span class="keyword">this</span>.internalState =<span class="number">10</span>;</span><br><span class="line">   &#125;  </span><br><span class="line">  <span class="comment">//  改变内部状态,触发状态的观察者列表</span></span><br><span class="line">  change(val)&#123;</span><br><span class="line">    <span class="keyword">this</span>.internalState = val;</span><br><span class="line">    <span class="keyword">this</span>.observers.forEach(<span class="function"><span class="params">observer</span>=&gt;</span>observer(val))</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="comment">// 注册观察者</span></span><br><span class="line">  registerObserver(ObserverFn)&#123;</span><br><span class="line">     <span class="keyword">this</span>.obserers.push(ObserverFn)</span><br><span class="line">  &#125;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<h2 id="observer-观察者模式2"><a href="#observer-观察者模式2" class="headerlink" title="observer [观察者模式2]"></a>observer [观察者模式2]</h2><ul>
<li>观察者 [Observer]</li>
<li>监听队里 [observers]</li>
<li>订阅者 [watcher]</li>
</ul>
<h3 id="概念"><a href="#概念" class="headerlink" title="概念"></a>概念</h3><p><font color="red"> 通常称为 发布-订阅者模式或消息模式,它定义了对象间的一种一对多的依赖关系,只要当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并自动更新,解决了主体对象与观察者之间功能的耦合,即一个对象状态改变给其他对象通知的问题</font></p>
<h3 id="创建观察者"><a href="#创建观察者" class="headerlink" title="创建观察者"></a>创建观察者</h3><ul>
<li>方法容器</li>
<li>订阅消息方法 [on]</li>
<li>取消订阅消息方法 [off]</li>
<li>发送订阅消息 [subscribe]</li>
</ul>
<p>内容来源于 <a href="https://zhuanlan.zhihu.com/p/24980136" target="_blank" rel="noopener">链接</a><br>内容来源于2 <a href="https://juejin.im/post/5c984610e51d45656702a785" target="_blank" rel="noopener">链接</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2020/04/09/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" data-id="ck8sihjgb00031gvb6xbe6vf7" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-npm" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2020/04/03/npm/" class="article-date">
  <time datetime="2020-04-03T01:44:46.838Z" itemprop="datePublished">2020-04-03</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2020/04/03/npm/">npm</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="npm-是什么"><a href="#npm-是什么" class="headerlink" title="npm 是什么?"></a>npm 是什么?</h1><h1 id="npm-和-npx-的区别"><a href="#npm-和-npx-的区别" class="headerlink" title="npm 和 npx 的区别"></a>npm 和 npx 的区别</h1>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2020/04/03/npm/" data-id="ck8sihjg000021gvbd96zfz7g" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="photo-vue" class="article article-type-photo" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2020/03/30/vue/" class="article-date">
  <time datetime="2020-03-30T07:46:15.000Z" itemprop="datePublished">2020-03-30</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2020/03/30/vue/">vue</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2020/03/30/vue/" data-id="ck8sihjfz00011gvb6gdb29mq" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-es6" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2020/03/30/es6/" class="article-date">
  <time datetime="2020-03-30T06:37:05.000Z" itemprop="datePublished">2020-03-30</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2020/03/30/es6/">es6</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="promise"><a href="#promise" class="headerlink" title="promise"></a>promise</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> p1 = <span class="keyword">new</span> <span class="built_in">Promise</span>(<span class="function"><span class="keyword">function</span> (<span class="params">resolve</span>) </span>&#123;</span><br><span class="line">  setTimeout(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">    resolve(<span class="number">1</span>);</span><br><span class="line">  &#125;, <span class="number">1000</span>);</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line">p1.then(<span class="function"><span class="keyword">function</span> (<span class="params">val</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">var</span> p3 = <span class="keyword">new</span> <span class="built_in">Promise</span>(<span class="function"><span class="keyword">function</span> (<span class="params">resolve</span>) </span>&#123;</span><br><span class="line">    setTimeout(<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">      resolve(val + <span class="number">1</span>);</span><br><span class="line">    &#125;, <span class="number">1000</span>);</span><br><span class="line">  &#125;);</span><br><span class="line"></span><br><span class="line">  <span class="keyword">return</span> p3;</span><br><span class="line">&#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">val</span>) </span>&#123;</span><br><span class="line">  <span class="built_in">console</span>.log(val);</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<h3 id="Iterator"><a href="#Iterator" class="headerlink" title="Iterator"></a>Iterator</h3><h3 id="心得"><a href="#心得" class="headerlink" title="心得"></a>心得</h3><ul>
<li><strong>项目中一定要区分哪些是异步函数哪些是功能函数</strong></li>
<li><strong>功能函数的划分</strong></li>
<li><strong>函数的返回值</strong></li>
<li><strong>类和函数的区别</strong></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2020/03/30/es6/" data-id="ck8sihjfu00001gvbf8mv0psz" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-英语" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2020/03/30/%E8%8B%B1%E8%AF%AD/" class="article-date">
  <time datetime="2020-03-30T06:37:05.000Z" itemprop="datePublished">2020-03-30</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2020/03/30/%E8%8B%B1%E8%AF%AD/">英语</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="词类"><a href="#词类" class="headerlink" title="词类"></a>词类</h2><p>名词: 表示人或事物的名称  专有名词 普通名词 人名地名等</p>
<ol>
<li>名词的数<br>可数名词是指能以数目来计算,可以分成个体的人或东西,因此它有复数形式,当它的复数形式在句子中做主语时,句子的谓语也应用复数形式</li>
<li>名词所有格<br>名词所有格用以表示名词之前的所有关系. 主要有 of 和 s(‘)两种表示方式</li>
<li>可数名词<br>可数名词,分为单数和复数两种形式,可数名词前可以用不定冠词,数词或some ,many等修饰</li>
<li>不可数名词<br>代词: 代替名词, 形容词 或数词 人称代词,物主代词,反身代词,相互代词,指示代词,  疑问代词,不定代词,关系代词,连接代词<ol>
<li>人称代词 代替人或事物的名称,分为主格人称代词和宾格人称代词</li>
<li>物主代词是表示所有关系的代词,分为形容词性物主代词和名词性物主代词两种. 形容词性物主代词相当于形容词,置于名词前做定语.名词性物主代词相当于名词<br>不能用于名词前</li>
<li>反身代词</li>
<li>疑问代词<br>what which where<br>数词: 表示数量或顺序 基数词,序数词</li>
<li>基数词</li>
<li>序数词</li>
</ol>
</li>
</ol>
<p>动词: 表示动作或状态 实义动词(及物动词,不及物动词),系动词,助动词,情态动词等</p>
<ol>
<li>动词的第三人称单数形式</li>
<li>动词的 ing形式  </li>
<li>情态动词<br>情态动词本书有一定的词义,表示语气的单词. 但是不能独立作为谓语,只能喝动词</li>
<li>根据其在句中的功能，动词可分为行为动词、系动词、助动词和情态动词四类，有些动词是兼类词。</li>
<li>动词的基本形式<br>绝大多数动词都有五种基本形式：动词原形、一般现在时第三人称单数、过去式、过去分词和现在分词<br>。</li>
<li>动名词 </li>
<li>动词不定式 由 to + 动词原形构成,不定式是一种非限定动词.它可以支配宾语,</li>
<li>分词 具有动词及形容词二者特征的词; 尤指以 ing,ed,d,t,en或n 结尾的英语动词性形容词,具有形容词功能<br>,同时又表现各种动词性特点,如时态,语态,带状语性修饰语的性能及带宾语的性能<br>形容词: 表示名词的特征<br>副词:修饰动词,形容词,其他副词或全局,表示状态特征或行为  时间和频度副词,地点副词,方式副词,程度副词,疑问副词,关系副词,连接副词,顺序副词,完成时副词</li>
</ol>
<p>冠词:用在名词前,说明名词所指的人,物 定冠词,不定冠词 the<br>介词:用在名词,代词前,表示实词,代词等与其它词的关系 简单介词,合成介词,重叠介词,短语介词,分词介词<br>连词: 用来连接词与词,短语与短语,句与句  并列连词,从属连词<br>感叹词: 表示说话时的感情或口气</p>
<h2 id="语句"><a href="#语句" class="headerlink" title="语句"></a>语句</h2><p>陈述句 说明一个事实或陈述发言人的看法 肯定句,否定句</p>
<p>疑问句 提出问题 一般疑问句,选择疑问句,反意疑问句,特殊疑问句 等</p>
<p>祈使句 表示请求 命令 劝告,建议 等</p>
<p>感叹句 表示喜怒哀乐等强烈的情感</p>
<p>简单句: 只有一套主 谓语的句子</p>
<p>并列句:由两个以及以上并列而又互相独立的简单句构成</p>
<p>主从句 :由一个主句和至少一个从句构成  主语从句 杓鹬从句,宾语从句,定语从句,状语从句等</p>
<h2 id="时态"><a href="#时态" class="headerlink" title="时态"></a>时态</h2><h2 id="语态"><a href="#语态" class="headerlink" title="语态"></a>语态</h2><ol>
<li>主动语态<br>主语时谓语动作的⑩动方. 也就是说谓语的动作源自主语,而施加于宾语.相反,被动语态中,主语时谓语动作的受动方,如果有宾语的,宾语往往是谓语动作的使dong<br>方<br>在语法机构中,主动语态和被动语态的区别主要在于,主动语态直接使用动词原形</li>
<li>被动语态</li>
</ol>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2020/03/30/%E8%8B%B1%E8%AF%AD/" data-id="ck8sihjgc00041gvbeod5f5yl" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  


</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/04/">四月 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/03/">三月 2020</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2020/04/09/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/">设计模式</a>
          </li>
        
          <li>
            <a href="/2020/04/03/npm/">npm</a>
          </li>
        
          <li>
            <a href="/2020/03/30/vue/">vue</a>
          </li>
        
          <li>
            <a href="/2020/03/30/es6/">es6</a>
          </li>
        
          <li>
            <a href="/2020/03/30/%E8%8B%B1%E8%AF%AD/">英语</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2020 GWM<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">主页</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">

  
<script src="/fancybox/jquery.fancybox.pack.js"></script>




<script src="/js/script.js"></script>




  </div>
</body>
</html>